var t, e, a = getApp(), i = a.apiUrl("store/detail2");
var ru_id =a.globalData.ru_id;
var c = function (a, cat_id) {
  t = wx.getStorageSync("token");
  1 == a.data.isListData && wx.request({
    url:i,
    data: {
      id: ru_id,
      ru_id:ru_id,
      page: 1,
      per_page: 100,
      cate_key: "is_on_sale",
      sort: "sort_order",
      order: "ASC",
      cat_id: cat_id,
    },
    header: {
      "Content-Type": "application/json",
      "X-ECTouch-Authorization": t
    },
    method: "POST",
    success: function (t) {
      // console.log('t',t)
        a.setData({
          store_goods: t.data.goods,
          cateData: t.data.category,
          isListData: "" != t.data.goods
        })
    }
  });
};
Page({
    data: {
        searchColor: "rgba(0,0,0,0.4)",
        searchSize: "16",
        searchName: "搜索商品",
        hidden: !1,
        curNav: 53,
        curIndex: 0,
        cateData: [],
        isListData: !0,
    },
    onLoad: function (options) {

    },
    onShow: function(){
      var e = this;
      // a.getUserInfo();
      var cat_id = wx.getStorageSync("cat_id") == '' ? 53 : wx.getStorageSync("cat_id");
      e.setData({
        curNav:cat_id
      })
      c(e, cat_id);
    },
    selectNav: function(a) {
      var t = String(a.target.dataset.id),
       e = parseInt(a.target.dataset.index);
        wx.setStorageSync("cat_id", t);
        self = this, this.setData({
            curNav: t,
            curIndex: e,
            scrollTop: 0
        });
      c(self, t);
    },
    onShareAppMessage: function() {
        return {
            title: "全部分类",
            desc: "小程序本身无需下载，无需注册，不占用手机内存，可以跨平台使用，响应迅速，体验接近原生App",
            path: "/pages/categroy/index"
        };
    }
});